/*
 * @Author: zhangyang
 * @Date: 2023-12-15 11:24:31
 * @LastEditTime: 2023-12-15 15:10:50
 * @Description:
 */
import { defineConfig } from 'astro/config'
import JsonConf from '@bluesyoung/unplugin-json-conf/vite'
import vue from '@astrojs/vue'
import { loadEnv } from 'vite'
import UnoCSS from 'unocss/astro'

const { VITE_JSON_CONF_URL } = loadEnv(process.env.NODE_ENV, process.cwd(), '')
console.log('🚀 ~ file: astro.config.mjs:15 ~ VITE_JSON_CONF_URL:', VITE_JSON_CONF_URL)

// https://astro.build/config
export default defineConfig({
  integrations: [
    vue(),
    UnoCSS({
      injectReset: true,
    }),
  ],
  server: {
    host: true,
  },
  vite: {
    build: {
      target: ['chrome58'],
      cssTarget: ['chrome58'],
    },
    plugins: [
      JsonConf({
        json_path: VITE_JSON_CONF_URL,
      }),
    ],
  },
})
